

<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  
  <title>使用python编写svn钩子 | k1988</title>
  <meta name="author" content="赵海洋">
  
  <meta name="description" content="个人博客">
  
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <meta property="og:title" content="使用python编写svn钩子"/>
  <meta property="og:site_name" content="k1988"/>

  
    <meta property="og:image" content="undefined"/>
  

  <link href="/favicon.ico" rel="icon" type="image/x-ico">
  <link rel="alternate" href="http://k1988.github.com/rss.xml" title="k1988" type="application/rss+xml">
  <link rel="stylesheet" href="/css/style.css" media="screen" type="text/css">
  <!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
  <script src="//libs.baidu.com/jquery/1.8.0/jquery.min.js"></script>
</head>


<body>
  <header id="header" class="inner">
<div class="alignleft">
  <h1><a href="/">k1988</a></h1>
  <h2><a href="/"></a></h2>
</div>
<nav id="main-nav" class="alignright">
  <ul>
    
      <li><a href="/">首页</a></li>
    
      <li><a href="/archives">归档</a></li>
    
      <li><a href="/about">关于</a></li>
    
	<li> <a href="/rss.xml">RSS</a> </li>
<li> <a title="把这个链接拖到你的Chrome收藏夹工具栏中" href='javascript:(function() {
	function c() {
		var e = document.createElement("link");
		e.setAttribute("type", "text/css");
		e.setAttribute("rel", "stylesheet");
		e.setAttribute("href", f);
		e.setAttribute("class", l);
		document.body.appendChild(e)
	}
 
	function h() {
		var e = document.getElementsByClassName(l);
		for (var t = 0; t < e.length; t++) {
			document.body.removeChild(e[t])
		}
	}
 
	function p() {
		var e = document.createElement("div");
		e.setAttribute("class", a);
		document.body.appendChild(e);
		setTimeout(function() {
			document.body.removeChild(e)
		}, 100)
	}
 
	function d(e) {
		return {
			height : e.offsetHeight,
			width : e.offsetWidth
		}
	}
 
	function v(i) {
		var s = d(i);
		return s.height > e && s.height < n && s.width > t && s.width < r
	}
 
	function m(e) {
		var t = e;
		var n = 0;
		while (!!t) {
			n += t.offsetTop;
			t = t.offsetParent
		}
		return n
	}
 
	function g() {
		var e = document.documentElement;
		if (!!window.innerWidth) {
			return window.innerHeight
		} else if (e && !isNaN(e.clientHeight)) {
			return e.clientHeight
		}
		return 0
	}
 
	function y() {
		if (window.pageYOffset) {
			return window.pageYOffset
		}
		return Math.max(document.documentElement.scrollTop, document.body.scrollTop)
	}
 
	function E(e) {
		var t = m(e);
		return t >= w && t <= b + w
	}
 
	function S() {
		var e = document.createElement("audio");
		e.setAttribute("class", l);
		e.src = i;
		e.loop = false;
		e.addEventListener("canplay", function() {
			setTimeout(function() {
				x(k)
			}, 500);
			setTimeout(function() {
				N();
				p();
				for (var e = 0; e < O.length; e++) {
					T(O[e])
				}
			}, 15500)
		}, true);
		e.addEventListener("ended", function() {
			N();
			h()
		}, true);
		e.innerHTML = " <p>If you are reading this, it is because your browser does not support the audio element. We recommend that you get a new browser.</p> <p>";
		document.body.appendChild(e);
		e.play()
	}
 
	function x(e) {
		e.className += " " + s + " " + o
	}
 
	function T(e) {
		e.className += " " + s + " " + u[Math.floor(Math.random() * u.length)]
	}
 
	function N() {
		var e = document.getElementsByClassName(s);
		var t = new RegExp("\\b" + s + "\\b");
		for (var n = 0; n < e.length; ) {
			e[n].className = e[n].className.replace(t, "")
		}
	}
 
	var e = 30;
	var t = 30;
	var n = 350;
	var r = 350;
	var i = "//s3.amazonaws.com/moovweb-marketing/playground/harlem-shake.mp3";
	var s = "mw-harlem_shake_me";
	var o = "im_first";
	var u = ["im_drunk", "im_baked", "im_trippin", "im_blown"];
	var a = "mw-strobe_light";
	var f = "//s3.amazonaws.com/moovweb-marketing/playground/harlem-shake-style.css";
	var l = "mw_added_css";
	var b = g();
	var w = y();
	var C = document.getElementsByTagName("*");
	var k = null;
	for (var L = 0; L < C.length; L++) {
		var A = C[L];
		if (v(A)) {
			if (E(A)) {
				k = A;
				break
			}
		}
	}
	if (A === null) {
		console.warn("Could not find a node of the right size. Please try a different page.");
		return
	}
	c();
	S();
	var O = [];
	for (var L = 0; L < C.length; L++) {
		var A = C[L];
		if (v(A)) {
			O.push(A)
		}
	}
})()    '>High一下</a> </li>

  </ul>
  <div class="clearfix"></div>
</nav>
<div class="clearfix"></div></header>
  <div id="content" class="inner">
    <div id="main-col" class="alignleft"><div id="wrapper"><article class="post">
  
    <div class="gallery">
  <div class="photoset">
    
      <img src="">
    
  </div>
  <div class="control">
    <div class="prev"></div>
    <div class="next"></div>
  </div>
</div>
  
  <div class="post-content">
    <header>
      
        <div class="icon"></div>
        <time datetime="2014-04-09T02:56:28.000Z"><a href="/2014/04/75/">2014-04-09</a></time>
      
      
  
    <h1 class="title">使用python编写svn钩子</h1>
  

    </header>
    <div class="entry">
      
        <p>同上一篇trac中安装插件的文章的出发点一样，感觉用文档和口头制定规则在执行上会有偏差并且需要经常引导新人去熟悉规则。</p>
<p>所以，又费了几个小时去琢磨怎么改进svn提交代码的钩子，现有的钩子的功能比较简单，只是验证提交时的日志字数有没有超过5个，而我想将其改进为验证是不是符合&ldquo;问题修复：#1234 xxxx&rdquo;的这种格式，这里处理的是 版本库/hooks/pre-commit.bat &nbsp;这个钩子。</p>
<p>话不多说，svn钩子原理和规则不表，先上<strong>原钩子代码</strong>：<br><a id="more"></a></p>
<div class="cnblogs_code"><br><pre><span style="color: #0000ff;">@echo</span> <span style="color: #0000ff;">off</span><br><span style="color: #008000;">rem</span><span style="color: #008000;"> SVN强制写注释的hooks脚本(Windows)</span><span style="color: #008000;"><br>rem</span><span style="color: #008000;"> 文件名是: pre-commit.bat,放到repository/hooks目录下</span><br><span style="color: #0000ff;">setlocal</span><br><span style="color: #0000ff;">set</span> SVN_BINDIR=”D:\service\Subversion\bin”<br><span style="color: #0000ff;">set</span> REPOS=<span style="color: #800080;">%1</span><br><span style="color: #0000ff;">set</span> TXN=<span style="color: #800080;">%2</span><br><span style="color: #008000;">rem</span><span style="color: #008000;"> check that logmessage contains at least 10 characters</span><br>%SVN_BINDIR%\svnlook log “%REPOS%” -t “%TXN%” | findstr “……” &gt;<span style="color: #000000;"> nul<br></span><span style="color: #0000ff;">if</span> %<span style="color: #0000ff;">errorlevel</span>% gtr 0 <span style="color: #0000ff;">goto</span><span style="color: #000000;"> err<br></span><span style="color: #0000ff;">exit</span> 0<br><span style="color: #800000;">:err</span><br><span style="color: #0000ff;">echo</span> 提交时必须填写说明(Message)! 1&gt;&amp;2<br><span style="color: #0000ff;">echo</span> “%REPOS%” -t “%TXN%” 1&gt;&amp;2<br><span style="color: #0000ff;">exit</span> 1</pre><br></div>

<p>一开始尝试使用直接修改bat，改进findstr来支持更复杂的正则表达式，但是遇到各种问题。</p>
<ol>
<li>首先是不太熟悉批处理的各种规则。</li>
<li>然后有些特殊字符在命令行上的不能使用。</li>
<li>再者就是使用在线工具验证过的正则表达式findstr匹配失败。</li>
</ol>
<p>在测试过程中保留了下面这个奇葩的中间版本(不能正常工作的)。</p>
<div class="cnblogs_code" onclick="cnblogs_code_show('e65fe15e-f01f-41bb-aa17-aa928ce698d0')"><img src="http://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif" alt=""><img src="http://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif" alt=""><br><div id="cnblogs_code_open_e65fe15e-f01f-41bb-aa17-aa928ce698d0" class="cnblogs_code_hide"><br><pre><span style="color: #008080;"> 1</span> <span style="color: #0000ff;">@echo</span> <span style="color: #0000ff;">off</span><br><span style="color: #008080;"> 2</span> <span style="color: #008000;">rem</span><span style="color: #008000;"> SVN强制写注释的hooks脚本(Windows)</span><br><span style="color: #008080;"> 3</span> <span style="color: #008000;">rem</span><span style="color: #008000;"> 文件名是: pre-commit.bat,放到repository/hooks目录下</span><br><span style="color: #008080;"> 4</span> <span style="color: #0000ff;">setlocal</span><br><span style="color: #008080;"> 5</span> <span style="color: #0000ff;">set</span> SVN_BINDIR=C:\Program <span style="color: #0000ff;">Files</span>\TortoiseSVN\<span style="color: #000000;">bin<br></span><span style="color: #008080;"> 6</span> <span style="color: #0000ff;">set</span> REPOS=<span style="color: #800080;">%1</span><br><span style="color: #008080;"> 7</span> <span style="color: #0000ff;">set</span> TXN=<span style="color: #800080;">%2</span><br><span style="color: #008080;"> 8</span><br><span style="color: #008080;"> 9</span> <span style="color: #008000;">rem</span><span style="color: #008000;"> check that logmessage contains at least 10 characters</span><br><span style="color: #008080;">10</span> “%SVN_BINDIR%\svnlook” log “%REPOS%” -t “%TXN%” &gt; t.<span style="color: #000000;">log<br></span><span style="color: #008080;">11</span><br><span style="color: #008080;">12</span> <span style="color: #800000;">:set</span> disable=:;’^&lt;^&gt;,<span style="color: #000000;">。&lsquo;<em>【】｛｝？?《》<br></em></span><span style="color: #008080;">13</span> <span style="color: #008000;">rem</span><span style="color: #008000;"> (#[0-9]+ )?[^#  允许带或不带ticket号开头，不支持非中文符号</span><br><span style="color: #008080;">14</span><br><span style="color: #008080;">15</span> findstr “^问题修复：(#[0-9]+ )…” t.<span style="color: #000000;">log<br></span><span style="color: #008080;">16</span> <span style="color: #0000ff;">@echo</span> %<span style="color: #0000ff;">errorlevel</span>% 1&gt;&amp;2<br><span style="color: #008080;">17</span> <span style="color: #0000ff;">if</span> <span style="color: #0000ff;">not</span> %<span style="color: #0000ff;">errorlevel</span>% gtr 0 <span style="color: #0000ff;">goto</span><span style="color: #000000;"> success<br></span><span style="color: #008080;">18</span> findstr “^功能开发：(#[0-9]+ )<em>[^#%disable%]</em>$” t.log &gt;<span style="color: #000000;"> nul<br></span><span style="color: #008080;">19</span> <span style="color: #0000ff;">if</span> <span style="color: #0000ff;">not</span> %<span style="color: #0000ff;">errorlevel</span>% gtr 0 <span style="color: #0000ff;">goto</span><span style="color: #000000;"> success<br></span><span style="color: #008080;">20</span> findstr “^功能改进：(#[0-9]+ )<em>[^#%disable%]</em>$” t.log &gt;<span style="color: #000000;"> nul<br></span><span style="color: #008080;">21</span> <span style="color: #0000ff;">if</span> <span style="color: #0000ff;">not</span> %<span style="color: #0000ff;">errorlevel</span>% gtr 0 <span style="color: #0000ff;">goto</span><span style="color: #000000;"> success<br></span><span style="color: #008080;">22</span> findstr “^功能优化：(#[0-9]+ )<em>[^#%disable%]</em>$” t.log &gt;<span style="color: #000000;"> nul<br></span><span style="color: #008080;">23</span> <span style="color: #0000ff;">if</span> <span style="color: #0000ff;">not</span> %<span style="color: #0000ff;">errorlevel</span>% gtr 0 <span style="color: #0000ff;">goto</span><span style="color: #000000;"> success<br></span><span style="color: #008080;">24</span> findstr “^代码优化：(#[0-9]+ )<em>[^#%disable%]</em>$” t.log &gt;<span style="color: #000000;"> nul<br></span><span style="color: #008080;">25</span> <span style="color: #0000ff;">if</span> <span style="color: #0000ff;">not</span> %<span style="color: #0000ff;">errorlevel</span>% gtr 0 <span style="color: #0000ff;">goto</span><span style="color: #000000;"> success<br></span><span style="color: #008080;">26</span><br><span style="color: #008080;">27</span> <span style="color: #800000;">:err</span><br><span style="color: #008080;">28</span> <span style="color: #0000ff;">echo</span> 未遵循svn提交规范 1&gt;&amp;2<br><span style="color: #008080;">29</span> <span style="color: #800000;">:echo</span> “%REPOS%” -t “%TXN%” 1&gt;&amp;2<br><span style="color: #008080;">30</span> <span style="color: #800000;">:rm</span> t.<span style="color: #000000;">log<br></span><span style="color: #008080;">31</span> <span style="color: #0000ff;">exit</span> 1<br><span style="color: #008080;">32</span><br><span style="color: #008080;">33</span> <span style="color: #800000;">:success</span><br><span style="color: #008080;">34</span> <span style="color: #800000;">:rm</span> t.<span style="color: #000000;">log<br></span><span style="color: #008080;">35</span> <span style="color: #0000ff;">exit</span> 1</pre><br></div><br><span class="cnblogs_code_collapse">不成功的中间版本</span></div>

<p>可以看到，我无奈地将一个正则表达式一分为五，并且拆分成5个之后不会使用管道同时将参数传递(也不能吧？)给findstr，关键是我那么一大串在日志中禁用标点符号不知为何不能工作，反正断断续续(经常被人打断工作，去处理其它事)耗费了我3个小时去写测试的批处理和这个钩子批处理，还是搞不定。一念下，想起python这种神器，花了几分钟找到了正则表达式的match示例，又查阅了对于stdin输入的获取方法，然后直接写了个check.py去代替findstr来匹配正则表达式(其实这思路是上午查看trac的TracTicketValidatorPlugin插件时看代码得到的)，然后再花2分钟验证之，搞定，上代码：</p>
<ul>
<li><p>pre-commit.bat</p>
<div class="cnblogs_code"><br><pre><span style="color: #008080;"> 1</span> <span style="color: #0000ff;">@echo</span> <span style="color: #0000ff;">off</span><br><span style="color: #008080;"> 2</span> <span style="color: #008000;">rem</span><span style="color: #008000;"> SVN强制写注释的hooks脚本(Windows)</span><br><span style="color: #008080;"> 3</span> <span style="color: #008000;">rem</span><span style="color: #008000;"> 文件名是: pre-commit.bat,放到repository/hooks目录下</span><br><span style="color: #008080;"> 4</span> <span style="color: #0000ff;">setlocal</span><br><span style="color: #008080;"> 5</span> <span style="color: #0000ff;">set</span> SVN_BINDIR=”C:\Program Files\TortoiseSVN\bin”<br><span style="color: #008080;"> 6</span> <span style="color: #0000ff;">set</span> REPOS=<span style="color: #800080;">%1</span><br><span style="color: #008080;"> 7</span> <span style="color: #0000ff;">set</span> TXN=<span style="color: #800080;">%2</span><br><span style="color: #008080;"> 8</span><br><span style="color: #008080;"> 9</span> <span style="color: #008000;">rem</span><span style="color: #008000;"> check that logmessage contains at least 10 characters</span><br><span style="color: #008080;">10</span> %SVN_BINDIR%\svnlook log “%REPOS%” -t “%TXN%” | python check.py “……” 1&gt;&amp;2<br><span style="color: #008080;">11</span> <span style="color: #0000ff;">if</span> %<span style="color: #0000ff;">errorlevel</span>% gtr 0 <span style="color: #0000ff;">goto</span><span style="color: #000000;"> err<br></span><span style="color: #008080;">12</span> <span style="color: #0000ff;">exit</span> 0<br><span style="color: #008080;">13</span><br><span style="color: #008080;">14</span> <span style="color: #800000;">:err</span><br><span style="color: #008080;">15</span> <span style="color: #0000ff;">echo</span> 未遵循svn提交规范! 1&gt;&amp;2<br><span style="color: #008080;">16</span> <span style="color: #0000ff;">echo</span> “%REPOS%” -t “%TXN%” 1&gt;&amp;2<br><span style="color: #008080;">17</span> <span style="color: #0000ff;">exit</span> 1</pre><br></div>
</li>
<li><p>check.py (2014/04/10修正，使用unicode字符串以对全角符号进行正确匹配)</p>
<div class="cnblogs_code"><br><pre><span style="color: #008080;"> 1</span> <span style="color: #008000;">#</span><span style="color: #008000;"> coding=gbk</span><br><span style="color: #008080;"> 2</span> <span style="color: #0000ff;">import</span><span style="color: #000000;"> re<br></span><span style="color: #008080;"> 3</span> <span style="color: #0000ff;">import</span><span style="color: #000000;"> sys<br></span><span style="color: #008080;"> 4</span><br><span style="color: #008080;"> 5</span> input_file =<span style="color: #000000;"> sys.stdin<br></span><span style="color: #008080;"> 6</span><br><span style="color: #008080;"> 7</span> <span style="color: #008000;">#</span><span style="color: #008000;"> 如果不用unicode模式则在有全角字符的情况下匹配不成功</span><br><span style="color: #008080;"> 8</span> restr=u<span style="color: #800000;">‘</span><span style="color: #800000;">^((问题修复)|(功能开发)|(功能改进)|(功能优化)|(代码优化))：(#[0-9]+ )?[^#:;\’&lt;&gt;,。&lsquo;*【】｛｝？?《》\n\r]+$</span><span style="color: #800000;">‘</span><br><span style="color: #008080;"> 9</span> <span style="color: #0000ff;">for</span> s <span style="color: #0000ff;">in</span><span style="color: #000000;"> input_file:<br></span><span style="color: #008080;">10</span>     <span style="color: #008000;">#</span><span style="color: #008000;">先解码为unicode字符串</span><br><span style="color: #008080;">11</span>     u = s.decode(<span style="color: #800000;">‘</span><span style="color: #800000;">GBK</span><span style="color: #800000;">‘</span><span style="color: #000000;">)<br></span><span style="color: #008080;">12</span>     <span style="color: #0000ff;">print</span>(u<span style="color: #800000;">“</span><span style="color: #800000;">验证字符串:</span><span style="color: #800000;">“</span> +<span style="color: #000000;"> u)<br></span><span style="color: #008080;">13</span>     <span style="color: #0000ff;">if</span> re.match(restr, u) !=<span style="color: #000000;"> None:<br></span><span style="color: #008080;">14</span>         <span style="color: #0000ff;">print</span>(<span style="color: #800000;">“</span><span style="color: #800000;">匹配成功</span><span style="color: #800000;">“</span><span style="color: #000000;">)<br></span><span style="color: #008080;">15</span> <span style="color: #000000;">        exit(0)<br></span><span style="color: #008080;">16</span>     <span style="color: #0000ff;">else</span><span style="color: #000000;">:<br></span><span style="color: #008080;">17</span>         exit(1)</pre><br></div>

</li>
</ul>
<p>&nbsp;</p>
<p>ps：</p>
<p>哎，用几年批处理，依然被诸如：启动进程进获取打印信息，字符串截取，字符串拼装等一些简单操作给难倒，感觉每次写批处理都是在 拼凑-&gt;试一下 的无限循环，不学点新东西就落后了。</p>

      
    </div>
    <footer>
      
        
  
  <div class="categories">
    <a href="/categories/python/">python</a>
  </div>

        
  
  <div class="tags">
    <a href="/tags/python/">python</a>, <a href="/tags/svn/">svn</a>, <a href="/tags/钩子/">钩子</a>
  </div>

<!-- Baidu Button BEGIN -->
<div id="bdshare" class="bdshare_t bds_tools_32 get-codes-bdshare">
<a class="bds_qzone"></a>
<a class="bds_tsina"></a>
<a class="bds_tqq"></a>
<a class="bds_renren"></a>
<a class="bds_t163"></a>
<span class="bds_more"></span>
<a class="shareCount"></a>
</div>
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=3326447" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->      
      <div class="clearfix"></div>
    </footer>
  </div>
</article>



 <nav id="pagination" >
    
    <a href="/2014/08/72/" class="alignleft prev" >上一页</a>
    
    
    <a href="/2014/04/73/" class="alignright next" >下一页</a>
    
    <div class="clearfix"></div>
</nav>

<section id="comment">

<!-- 多说评论框 start -->
	<div class="ds-thread" data-thread-key="/2014/04/75/" data-title="使用python编写svn钩子" data-url="/2014/04/75/"></div>
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"k1988"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		 || document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
<!-- 多说公共JS代码 end -->

  
</section>

</div></div>
    <aside id="sidebar" class="alignright">
  <div class="search">
  <form action="//google.com/search" method="get" accept-charset="utf-8">
    <input type="search" name="q" results="0" placeholder="搜索">
    <input type="hidden" name="q" value="site:baba.zhaoxiuyuan.com">
  </form>
</div>

  
<div class="widget tag">
  <h3 class="title">分类</h3>
  <ul class="entry">
  
    <li><a href="/categories/C/">C++</a><small>4</small></li>
  
    <li><a href="/categories/net/P2P/">P2P</a><small>2</small></li>
  
    <li><a href="/categories/WEB/">WEB</a><small>1</small></li>
  
    <li><a href="/categories/WINDOWS编程/">WINDOWS编程</a><small>6</small></li>
  
    <li><a href="/categories/bugs/">bugs</a><small>2</small></li>
  
    <li><a href="/categories/ie/flash/">flash</a><small>1</small></li>
  
    <li><a href="/categories/ie/">ie</a><small>1</small></li>
  
    <li><a href="/categories/java/">java</a><small>5</small></li>
  
    <li><a href="/categories/java/minecraft/">minecraft</a><small>2</small></li>
  
    <li><a href="/categories/net/">net</a><small>2</small></li>
  
    <li><a href="/categories/python/">python</a><small>1</small></li>
  
    <li><a href="/categories/windows/">windows</a><small>2</small></li>
  
    <li><a href="/categories/bugs/windows/">windows</a><small>1</small></li>
  
    <li><a href="/categories/工具/">工具</a><small>1</small></li>
  
    <li><a href="/categories/开源项目/">开源项目</a><small>2</small></li>
  
    <li><a href="/categories/未分类/">未分类</a><small>0</small></li>
  
    <li><a href="/categories/系统-工具/">系统/工具</a><small>7</small></li>
  
    <li><a href="/categories/软件/">软件</a><small>2</small></li>
  
  </ul>
</div>


  <div class="widget tag">
<h3 class="title">简介</h3>
<ul class="entry">
<li>本体：赵海洋</li>
<li>二次元：k1988 | 赵大海</li>
<li>现状：大蓝鲸某IT公司研发部经理</li>
<li>QQ 号：1811132352</li>
<li>早期博客：<a href="http://blog.csdn.net/k1988/">CSDN博客</a></li>
</ul>
</div>



  <iframe width="100%" height="550" class="share_self"  frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=550&fansRow=2&ptype=1&speed=0&skin=1&isTitle=1&noborder=1&isWeibo=1&isFans=1&uid=1196349092&verifier=d3636f5c&dpc=1"></iframe>
</aside>
    <div class="clearfix"></div>
  </div>
  <footer id="footer" class="inner"><section>
Theme of <a href="https://github.com/k1988/lightum">Lightum</a>, Improved from <a href="https://github.com/hexojs/hexo-theme-light">Light</a>, by <a href="/">k1988</a> 
<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<span id="busuanzi_container_site_pv">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span>
</section>
<div class="clearfix"></div>
</footer>
  <script src="//libs.baidu.com/jquery/2.0.3/jquery.min.js"></script>
<script src="/js/jquery.imagesloaded.min.js"></script>
<script src="/js/gallery.js"></script>




<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
(function($){
  $('.fancybox').fancybox();
})(jQuery);
</script>


<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</body>
</html>


<a href="https://github.com/k1988" target="_blank"><img style="position: absolute; top: 0; left: 0; border: 0;" src="/imgs/forkme_left_green_007200.png" alt="Fork me on GitHub"></a>
